<?php
require ('../Common/db.php');
$cid = $_POST['cid'];
$content = $_POST['content'];
//插入数据库
$sql = "update comments set content='$content' where cid=$cid";
echo $sql.'<br/>';
//执行SQL语句
$result = mysql_query($sql) or die('插入失败！'.mysql_error());
//判断是否插入成功
$num = mysql_affected_rows();
if($num!=1){
    echo "更新失败,2秒后返回留言列表";
    header("refresh:2;url='CommentList.php'");
} else {
    header("location:CommentList.php");
}
//关闭数据库
mysql_close();
?>